package com.lqq.designPattern.bulider_pattern.factory.simpleFactory;

//简单咖啡工厂类，用来生产咖啡
public class SimpleCoffeeFactory {
    public Coffee createCoffee(String type) {
        Coffee coffee = null;
        if (type.equals("AmericanCoffee")) {
            coffee = new AmericanCoffee();
        }
        else if (type.equals("LatteCoffee")) {
            coffee = new LatteCoffee();
        }
        else {
            throw new RuntimeException("没有你需要的咖啡！");
        }
        return coffee;
    }
}
